package com.jiawa.train.business.enums;

public enum SkTokenEnum {
    ERROR_NOT_FOUND(1, "令牌记录不存在"),
    ERROR_YDZ_NOT_ENOUGH(2, "一等座令牌不足"),
    ERROR_EDZ_NOT_ENOUGH(3, "二等座令牌不足"),
    SUCCESS(4, "令牌校验成功");

    private final int code;
    private final String desc;

    SkTokenEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    // 可以通过code反查enum，也很有用
    public static SkTokenEnum getByCode(int code) {
        for (SkTokenEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
